<?php
/**
 * Created by PhpStorm.
 * User: 王松
 * Time: 2017/12/15 15:06
 */

namespace App\Project\Search\Translate;

use Illuminate\Support\Arr;

class PhysicalTranslate
{
    public function ebpl($value)
    {
        $value = json_decode($value, true);

        return Arr::get($value, 'blood_pressure.low');
    }

    public function ebph($value)
    {
        $value = json_decode($value, true);

        return Arr::get($value, 'blood_pressure.high');
    }

    public function et($value)
    {
        $value = json_decode($value, true);

        return $value['thyroid'];
    }

    public function ee($value)
    {
        $value = json_decode($value, true);

        return $value['edema'];
    }

    public function esr($value)
    {
        $value = json_decode($value, true);

        return $value['skin_rupture'];
    }

    public function ellp($value)
    {
        $value = json_decode($value, true);

        return $value['skin_rupture'];
    }

    public function os($value)
    {
        $value = json_decode($value, true);

        if (1 == $value['sfp']) {
            return '阳性';
        } elseif (2 == $value['sfp']) {
            return '阴性';
        }

        return '不详';
    }

    public function obh($value)
    {
        $value = json_decode($value, true);

        if (1 == $value['buffalo_hump']) {
            return '阳性';
        } elseif (2 == $value['buffalo_hump']) {
            return '阴性';
        }

        return '不详';
    }

    public function oan($value)
    {
        $value = json_decode($value, true);

        if (1 == $value['acanthosis_nigricans']) {
            return '阳性';
        } elseif (2 == $value['acanthosis_nigricans']) {
            return '阴性';
        }

        return '不详';
    }

    public function oe($value)
    {
        $value = json_decode($value, true);

        if (1 == $value['ecchymosis']) {
            return '阳性';
        } elseif (2 == $value['ecchymosis']) {
            return '阴性';
        }

        return '不详';
    }

    public function oa($value)
    {
        $value = json_decode($value, true);

        if (1 == $value['apl']) {
            return '阳性';
        } elseif (2 == $value['apl']) {
            return '阴性';
        }

        return '不详';
    }

    public function oar($value)
    {
        $value = json_decode($value, true);

        $physical = app('field')->get('physical');

        return $physical['ankle_reflex'][$value['ankle_reflex']];
    }

    public function ob($value)
    {
        $value = json_decode($value, true);

        $physical = app('field')->get('physical');

        return $physical['btnp'][$value['btnp']];
    }

    public function obs($value)
    {
        $value = json_decode($value, true);

        $physical = app('field')->get('physical');

        return $physical['bttfvs'][$value['bttfvs']];
    }

    public function o10g($value)
    {
        $value = json_decode($value, true);

        $physical = app('field')->get('physical');

        return $physical['10gnt'][$value['10gnt']];
    }
}